<template>
  <div class="app-container">
    <div class="top">
      <el-form ref="form" :model="form" label-width="80px">
        <el-input
          size="small"
          v-model="date.grouponRuleId"
          placeholder="请输入团购规则ID"
        ></el-input>
      </el-form>
      <el-button
        type="primary"
        icon="el-icon-search"
        style="padding: 0 10px; height: 30px"
        @click="find"
        >查找</el-button
      >
      <el-button
        type="primary"
        icon="el-icon-search"
        style="padding: 0 10px; height: 30px"
        >导出</el-button
      >
    </div>
    <div class="foot">
      <el-table :data="list" border style="width: 100%">
        <el-table-column type="expand">
          <template slot-scope="props">
            <el-table>
              <el-table-column prop="date" label="订单ID" align="center" width="633.5">
                {{ props.row.name }}
              </el-table-column>
              <el-table-column prop="date" label="订单ID" align="center" width="634">
                {{ props.row.name }}
              </el-table-column>
            </el-table>
          </template></el-table-column
        >
        <el-table-column prop="groupon.orderId" align="center" label="订单ID" width="180">
        </el-table-column>
        <el-table-column prop="groupon.userId" align="center" label="用户ID" width="180">
        </el-table-column>
        <el-table-column prop="groupon.grouponId" align="center" label="参与人数" width="180">
        </el-table-column>
        <el-table-column prop="rules.discount" align="center" label="团购折扣" width="180">
        </el-table-column>
        <el-table-column prop="rules.discountMember" align="center" label="团购要求" width="180">
        </el-table-column>
        <el-table-column prop="" align="center" label="分享图片"> </el-table-column>
        <el-table-column prop="rules.addTime" align="center" label="开始时间"> </el-table-column>
        <el-table-column prop="rules.expireTime" align="center" label="结束时间"> </el-table-column>
      </el-table>
    </div>
    <div class="bock">
      <el-pagination
        @size-change="handleSizeChange"
        @current-change="handleCurrentChange"
        :current-page="date.page"
        :page-sizes="[10, 20, 30, 40, 50, 100]"
        :page-size="date.limit"
        layout="total, sizes, prev, pager, next, jumper"
        :total="total"
      >
      </el-pagination>
    </div>
  </div>
</template>

<script>
import { getList } from '@/api/promotion';
export default {
  
  data() {
    return {
      form: {
        // grouponRuleId: "",
      },
      date: {
        page: 1,
        limit: 20,
        sort: "add_time",
        
        order: "desc",
      },
      datb: {
        page: 1,
        limit: 20,
        sort: "add_time",
        grouponRuleId:"",
        order: "desc",
      },
      
      list: [],
      total:0,
    };
  },
  created() {
    this.run();
  },
  methods: {
    run(){
      getList(this.date).then((res) =>{
        console.log(res)
        this.total=res.data.total;
        this.list=res.data.list;
      })
    },
    find(){
      this.date.page = 1;
      this.date.grouponRuleId=this.form.grouponRuleId;
      this.run();
    },
    handleSizeChange(newSize) {
      this.limit = newSize;
      this.run();
    },
    handleCurrentChange(newPage) {
      this.page = newPage;
      this.run();
    },
  },
};
</script>

<style scoped>
.top {
  display: flex;
}
::v-deep.el-table__expanded-cell[class*=cell]{
  padding: 0;
}

</style>